Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addBehavior #1302

Merged
merged 2 commits into from
Feb 26, 2017
Merged

addBehavior #1302

merged 2 commits into from
Feb 26, 2017

Conversation

cjohansen
Copy link
Contributor

@cjohansen cjohansen commented Feb 26, 2017

Purpose (TL;DR) - mandatory

Add a proper way to feed in custom behaviors, for people modifying sinon.behavior in 1.x

There's docs and a test explaining how this all works. Sinon now uses this mechanism to add its own behaviors, so I'm pretty confident this works as intended.

This PR fixes #993

The initial implementation forced behaviors to do things to `this`, which is
terrible API design (`this` being a dynamic/unstable implicit argument). This
commit passes the fake as the first explicit argument to behaviors instead,
allowing for a clean contract.
@coveralls
Copy link

coveralls commented Feb 26, 2017

Coverage Status

Coverage decreased (-0.04%) to 95.379% when pulling ba00de0 on add-behavior into 46e41c8 on master.

@mantoni
Copy link
Member

mantoni commented Feb 27, 2017

Awesome work, mate! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-expose lib/sinon/behaviour as a top-level export in Sinon 2
4 participants